#pragma once
#include"nx_processor/common_include.h"

namespace utils 
{
    namespace dataSets
    {
        
        
        const std::vector<std::string> armor = {"red", "blue"};
    }
    namespace Colors
    {
       
        
        const std::vector<cv::Scalar> color2={cv::Scalar(0,0,255),cv::Scalar(255,0,0)};
    }

    struct InitParameter
    {
        int num_class;
        std::vector<std::string> class_names;
        std::vector<std::string> input_output_names;

        bool dynamic_batch{ true };
        size_t batch_size;
        int src_h, src_w; 
        int dst_h, dst_w;

        float scale{ 255.f };
        float means[3] = { 0.f, 0.f, 0.f };
        float stds[3] = { 1.f, 1.f, 1.f };

        float iou_thresh;
        float conf_thresh;

        int topK{ 1000 };
    

        std::string winname = "TensorRT-Alpha";
        int char_width = 11; 
        int det_info_render_width = 15;
        double font_scale = 0.6;
        bool is_show = true;
    };


    struct Box
    {
        float left, top, right, bottom, confidence;
        int label;
        std::vector<cv::Point2i> land_marks;

        Box() = default;
        Box(float left, float top, float right, float bottom, float confidence, int label) :
            left(left), top(top), right(right), bottom(bottom), confidence(confidence), label(label) {}

        Box(float left, float top, float right, float bottom, float confidence, int label, int numLandMarks) :
            left(left), top(top), right(right), bottom(bottom), confidence(confidence), label(label) 
        {
            land_marks.reserve(numLandMarks);
        }
    };

    enum class InputStream { CAMERA };

    enum class ColorMode { RGB, GRAY };

    struct AffineMat
    {
        float v0, v1, v2;
        float v3, v4, v5;
    };

    
    std::vector<unsigned char> loadModel(const std::string& file);

    bool setInputStream(const InputStream& source, const int& cameraID,
        cv::VideoCapture& capture, int& totalBatches, int& delayTime, InitParameter& param);

    
    void show(const std::vector<std::vector<Box>>& objectss, const std::vector<std::string>& classNames,
        const int& cvDelayTime, std::vector<cv::Mat>& imgsBatch);

    

    class DeviceTimer
    {
    public:
        DeviceTimer();
        float getUsedTime();
        // overload
        DeviceTimer(cudaStream_t ctream);
        float getUsedTime(cudaStream_t ctream);

        ~DeviceTimer();

    private:
        cudaEvent_t start, end;
    };
}
